within ThreeD_MBS_Dynamics.Examples.OmniVehicle.PatchContact;

model MovingRollerTest
  parameter Integer n = 4 "Number of rollers";
  parameter Real alpha = Modelica.Constants.pi/n
    "Max angle of the half-sector";
  parameter Real R = 1 "Omni wheel outer radius";
  parameter Real R1 = R*cos(alpha) "Omni wheel inner radius";
  parameter Real omega0 = 10;
  Base base annotation (Placement(transformation(extent={{-80,-20},{-40,20}})));
  OnePortHeavyBody onePortHeavyBody(
    Gravity = {0, -1, 0},
    r(start = {0, 2, 0}),
    v(start = {0, 0, 0}),
    q(start = {1, 0, 0, 0}),
    omega(start = {omega0, 0, 0})) 
    annotation (Placement(transformation(extent={{40,-20},{80,20}})));
  RollerContactForces rollerContactForces 
    annotation (Placement(transformation(extent={{-20,-20},{20,20}})));
  annotation (Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,
            -100},{100,100}}),
                         graphics),
    experiment(
      StopTime=50,
      NumberOfIntervals=50000,
      Tolerance=1e-008),
    experimentSetupOutput);
equation
  connect(base.OutPort, rollerContactForces.InPortA) annotation (Line(
      points={{-60,-16},{-60,-40},{-8,-40},{-8,-16}},
      color={0,0,255},
      smooth=Smooth.None));
  connect(rollerContactForces.InPortB, onePortHeavyBody.OutPort) 
    annotation (Line(
      points={{8,-16},{8,-40},{60,-40},{60,-16}},
      color={0,0,255},
      smooth=Smooth.None));
  connect(rollerContactForces.OutPortB, onePortHeavyBody.InPort) 
    annotation (Line(
      points={{8,16},{8,40},{60,40},{60,16}},
      color={0,0,255},
      smooth=Smooth.None));
end MovingRollerTest;
